/**
 * Project Name:UIMS
 * File Name:User.java
 * Package Name:com.bgi.uims.module.sys.user.dto
 * CreateDate:2015年3月25日 上午10:44:50
 * Copyright (c) 2015, BGI_DX All Rights Reserved.
 */     

package com.bgi.uims.module.sys.user.dto;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

import com.bgi.uims.common.dto.Common;

/**
 * ClassName:User
 * Function: TODO 
 * Reason:	 TODO 
 * @CreateDate:2015年3月25日 上午10:44:50
 * @author   tantianhua
 * @version  
 * @since    JDK 1.7
 * @see 	 
 */

public class User extends Common {
	/**  
	 * serialVersionUID:TODO（用一句话描述这个变量表示什么）  
	 */   
	private static final long serialVersionUID = -26564776301944647L;
	/**
	 * 主键
	 */
	private String userId;
	/**
	 * 组织架构外键_DEPARTMENT_ID
	 */
	private String departmentId;
	/**
	 * 工号
	 */
	private String workNumber;
	/**
	 * 用户名
	 */
	private String userName;
	/**
	 * 密码
	 */
	private String passWord;
	/**
	 * 真实姓名
	 */
	private String realName;
	/**
	 * 性别(未知:0;女:1;男：2)
	 */
	private String userGender;
	/**
	 * 出生日期
	 */
	private String birthDay;
	/**
	 * 电子邮箱
	 */
	private String userEmail;
	/**
	 * 手机号码
	 */
	private String mobileNum;
	/**
	 * 电话号码
	 */
	private String phoneNum;
	/**
	 * QQ
	 */
	private String qqNum;
	/**
	 * 联系地址
	 */
	private String userAddress;
	/**
	 * 账号状态(禁用:0;启用：1)
	 */
	private String accountCount;
	/**
	 * 登录次数
	 */
	private Integer userCount;
	/**
	 * 25*25
	 */
	private String userSmallPhoto;
	/**
	 * 30*30
	 */
	private String userNormalPhoto;
	/**
	 * 50*50
	 */
	private String userMiddlePhoto;
	/**
	 * 最近一次登录时间
	 */
	private String lastLoginTime;
	/**
	 * 记录创建者
	 */
	private String createUser;
	/**
	 * 记录创建时间
	 */
	private String createTime;
	/**
	 * 记录最后修改者
	 */
	private String lastModifiedUser;
	/**
	 * 记录最后修改时间
	 */
	private String lastModifiedTime;
	/**
	 * 附加信息 ：角色
	 */
	private String manageRole;
	
	private String[] manageRoleArray;
	/**
	 * 附加信息 ：角色ID 登陆时记录登陆人的角色ID
	 */
	private String rolesId;
	/**
	 * 统计年份（辅助字段）
	 */
	private String countYear;
	/**
	 * 附加信息: 所属组织名称
	 */
	private String departmentName;
	/**
	 * 辅助属性，历史记录时，程序单独添加记录信息
	 */
	private Map<String,String>  specialHistory;
	public String getManageRole() {
		return manageRole;
	}
	public void setManageRole(String manageRole) {
		this.manageRole = manageRole;
	}
	public String[] getManageRoleArray() {
		return manageRoleArray;
	}
	public void setManageRoleArray(String[] manageRoleArray) {
		this.manageRoleArray = manageRoleArray;
	}
	public String getUserId() {
		return userId;
	}
	public void setUserId(String userId) {
		this.userId = userId;
	}
	public String getDepartmentId() {
		return departmentId;
	}
	public void setDepartmentId(String departmentId) {
		this.departmentId = departmentId;
	}
	public String getWorkNumber() {
		return workNumber;
	}
	public void setWorkNumber(String workNumber) {
		this.workNumber = workNumber;
	}
	public String getUserName() {
		return userName;
	}
	public void setUserName(String userName) {
		this.userName = userName;
	}
	public String getRealName() {
		return realName;
	}
	public void setRealName(String realName) {
		this.realName = realName;
	}
	public String getUserGender() {
		return userGender;
	}
	public void setUserGender(String userGender) {
		this.userGender = userGender;
	}
	public String getBirthDay() {
		return birthDay;
	}
	public void setBirthDay(String birthDay) {
		this.birthDay = birthDay;
	}
	public String getUserEmail() {
		return userEmail;
	}
	public void setUserEmail(String userEmail) {
		this.userEmail = userEmail;
	}
	public String getMobileNum() {
		return mobileNum;
	}
	public void setMobileNum(String mobileNum) {
		this.mobileNum = mobileNum;
	}
	public String getPhoneNum() {
		return phoneNum;
	}
	public void setPhoneNum(String phoneNum) {
		this.phoneNum = phoneNum;
	}
	public String getQqNum() {
		return qqNum;
	}
	public void setQqNum(String qqNum) {
		this.qqNum = qqNum;
	}
	public String getUserAddress() {
		return userAddress;
	}
	public void setUserAddress(String userAddress) {
		this.userAddress = userAddress;
	}
	public String getAccountCount() {
		return accountCount;
	}
	public void setAccountCount(String accountCount) {
		this.accountCount = accountCount;
	}
	public Integer getUserCount() {
		return userCount;
	}
	public void setUserCount(Integer userCount) {
		this.userCount = userCount;
	}

	public String getUserSmallPhoto() {
		return userSmallPhoto;
	}
	public void setUserSmallPhoto(String userSmallPhoto) {
		this.userSmallPhoto = userSmallPhoto;
	}
	public String getUserNormalPhoto() {
		return userNormalPhoto;
	}
	public void setUserNormalPhoto(String userNormalPhoto) {
		this.userNormalPhoto = userNormalPhoto;
	}
	public String getUserMiddlePhoto() {
		return userMiddlePhoto;
	}
	public void setUserMiddlePhoto(String userMiddlePhoto) {
		this.userMiddlePhoto = userMiddlePhoto;
	}

	public String getLastLoginTime() {
		return lastLoginTime;
	}
	public void setLastLoginTime(String lastLoginTime) {
		this.lastLoginTime = lastLoginTime;
	}
	public String getCreateUser() {
		return createUser;
	}
	public void setCreateUser(String createUser) {
		this.createUser = createUser;
	}
	public String getCreateTime() {
		return createTime;
	}
	public void setCreateTime(String createTime) {
		this.createTime = createTime;
	}
	public String getLastModifiedUser() {
		return lastModifiedUser;
	}
	public void setLastModifiedUser(String lastModifiedUser) {
		this.lastModifiedUser = lastModifiedUser;
	}
	public String getLastModifiedTime() {
		return lastModifiedTime;
	}
	public void setLastModifiedTime(String lastModifiedTime) {
		this.lastModifiedTime = lastModifiedTime;
	}
	/**  
	 * rolesId  
	 * @return  the rolesId  
	 */
	public String getRolesId() {
		return rolesId;
	}
	/**  
	 * @param rolesId the rolesId to set  
	 */
	public void setRolesId(String rolesId) {
		this.rolesId = rolesId;
	}
	public String getPassWord() {
		return passWord;
	}
	public void setPassWord(String passWord) {
		this.passWord = passWord;
	}
	/**  
	 * countYear  
	 * @return  the countYear  
	 */
	public String getCountYear() {
		return countYear;
	}
	/**  
	 * @param countYear the countYear to set  
	 */
	public void setCountYear(String countYear) {
		this.countYear = countYear;
	}
	
	public Map<String, String> getSpecialHistory() {
		return specialHistory;
	}
	public void setSpecialHistory(Map<String, String> specialHistory) {
		this.specialHistory = specialHistory;
	}
	
	public String getDepartmentName() {
		return departmentName;
	}
	public void setDepartmentName(String departmentName) {
		this.departmentName = departmentName;
	}
	/**
	 * 将对象的信息以map形式返回，作为存储日志信息时的比较和存储
	 */
	@SuppressWarnings("rawtypes")
	public Map annotationObject(){
		Map<String,String> results = new HashMap<String, String>();
		results.put("object","用户");//必须有,对象描述
		results.put("table","sys_user");//必须有,表名描述
		results.put("tableId",this.userId);//必须有,表名描述
		results.put("describe","用户名"+this.userName);//必须有,可以指定到具体某一条，即该条的独有特性,可以描述此记录
		results.put("用户ID号", this.userId);
		results.put("用户名", this.userName);
		results.put("用户组织架构", this.departmentName);
		results.put("用户工号", this.workNumber);
		results.put("用户真实姓名", this.realName);
		String userGender = "";
		if(this.userGender != null && this.userGender.equals("0")){
			userGender = "未知";
		} else if(this.userGender != null && this.userGender.equals("1")){
			userGender = "男";
		} else if(this.userGender != null && this.userGender.equals("2")){
			userGender = "女";
		}
		results.put("用户性别", userGender);
		results.put("用户出生日期", this.birthDay);
		results.put("用户邮箱", this.userEmail);
		results.put("用户手机号码", this.mobileNum);
		results.put("用户电话号码", this.phoneNum);
		results.put("用户QQ", this.qqNum);
		results.put("用户地址", this.userAddress);
		String status = "";
		if(this.accountCount != null && this.accountCount.equals("1")){
			status = "启用";
		} else if(this.accountCount != null && this.accountCount.equals("0")){
			status = "禁用";
		}
		results.put("用户状态", status);
		
		Map<String,String> extendResults = new HashMap<String, String>();
		boolean flag = true;
		if(this.specialHistory != null){
			Iterator<String> keys =  this.specialHistory.keySet().iterator();
			while(keys.hasNext()){
				String key = keys.next();
				String value = this.specialHistory.get(key);
				if(key.equals("extends") ){
					if (value.equals("false")){
						flag = false;
					}
					continue;
				}
				extendResults.put(key, value);
			}
		}
		if(flag){
			results.putAll(extendResults);
		} else {
			return extendResults;
		}
		return results;
	}
	
}
